package com.fsoft.tinhcd.app;

import java.util.Date;

import org.hibernate.Session;

import com.fsoft.tinhcd.entity.Employee;
import com.fsoft.tinhcd.entity.Metting;
import com.fsoft.tinhcd.utils.HibernateUtils;

public class App {
	public static void main(String[] args) {
		HibernateUtils hibernateUtils = new HibernateUtils();
		Session session = hibernateUtils.getSessionFactory().openSession();
		session.getTransaction().begin();
		//
		Metting metting = new Metting("Meeting 1", new Date());
		Metting metting2 = new Metting("Meeting 2", new Date());
		//
		Employee employee = new Employee("cao", "dang tinh");
		Employee employee2 = new Employee("pham", "hong ha");
		//
		employee.getMettings().add(metting);
		employee.getMettings().add(metting2);
		//
		employee2.getMettings().add(metting);
		//
		session.save(employee);
		session.save(employee2);
		//
		session.getTransaction().commit();
		session.close();
		// add comments
	}
}
